package cn.antblog.code;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date;

/**
 * @author YangJingyi
 * @date 2021-08-30 14:57
 */
public class Test2 {
    public static void main(String[] args) throws ParseException {
        //Test2.BDIDateTest();
//
//        Map<String,List<String>> map = new HashMap<>();
//        map.put("1",Arrays.asList("111"));
//        map.put("2",Arrays.asList("111"));
//        List<List<String>> lists = new ArrayList<List<String>>(map.values());
//        System.out.println(lists);

//        char i = 65;
//        char j = 'j';
//
//        System.out.println(i-j);
//        List<Object> empty = ListUtil.empty();
//        ListUtil.list(false);

//       
//        String json = "{\"workOrder\":{\"title\":\"测试工单流程\",\"description\":\"测试\",\"status\":\"0\",\"remark\":\"测试\"},\"approver\":\"admin\",\"submitType\":\"0\"}";
//        JSONObject jsonObject = JSONObject.parseObject(json);
//        JSONObject workOrder = (JSONObject) jsonObject.get("workOrder");
//        System.out.println("workOrder = " + workOrder);

//        //参数1为终端ID
////参数2为数据中心ID IdUtil.getSnowflake
//        Snowflake snowflake = IdUtil.getSnowflake(1, 1);
//        long id = snowflake.nextId();
//        String nextIdStr = IdUtil.getSnowflake().nextIdStr();
//        System.out.println("snowflake1 = " + nextIdStr);
////简单使用
//        long id2 = IdUtil.getSnowflakeNextId();
//        System.out.println("id = " + id);
//        System.out.println("id2 = " + id2);
//
//
//        Date date = DateUtil.date();
//        String format = DateUtil.format(date, "yyyyMM");
//        System.out.println("format = " + format);
//
//
//        System.out.println("5" + 2);

//        Object a = null;
//        String.valueOf(a);
//        json "=" json
//        System.out.println("json" = = "json");

//        short s = 1;
//        //s = s + 1;
//        System.out.println(3 * 0.1);

//        Integer i = 0;
//        Integer c = Integer.valueOf(i);
//        Integer i = new Integer(42);
//        Long l = new Long(42);
//        Double d = new Double(42.0);
//
//        System.out.println(i.equals(d));
//        System.out.println(d.equals(i));
//        System.out.println(i.equals(42));
//        Random random = new Random();
//        int[] arr = new int[]{1, 2, 3, 4, 5};
//        for (int i = 0; i < 100; i++) {
//            int j = random.nextInt(5);
//            System.out.println("j = " + arr[j]);
//        }
        //String[] s = new String[]{"1"};

        String now = "2022-01-01";
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        LocalDate formatDateTime = LocalDate.parse(now, formatter);
        LocalDate date = formatDateTime.plusMonths(6);
        String format = date.format(formatter);
        System.out.println("Before : " + now); // Before : 2022-11-09 10:30
        System.out.println("After : " + date); // After : 2022-11-09T10:30
        System.out.println("After : " + date.format(formatter)); // After : 2022-11-09 10:30

        String timest = "20220101";
        String monthDayId = "20220101";
        String substring = timest.substring(4);
        if (monthDayId.equals("0101") || monthDayId.equals("0601")) {
        }
    }


    /**
     * BDI流程 所用日期测试
     */
    public static void BDIDateTest() throws ParseException {
        String timest = "20210830";
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");// 获取只有年月日的时间
        Date date = format.parse(timest);
        //System.out.println("两天前的日期：" + df.format(new Date(d.getTime() - 2 * 24 * 60 * 60 * 1000)));
        //计算一天前
        String oneDayAgo = format.format(new Date(date.getTime() - 1 * 24 * 60 * 60 * 1000));
        System.out.println(oneDayAgo);
    }
}



